package com.carnation.servlet;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.carnation.utils.SessionUtils;

public class DownLoadServlet extends HttpServlet{

	private static final long serialVersionUID = 1L;
	private Logger logger = Logger.getLogger(DownLoadServlet.class);
	
	protected void doPost(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse){
		boolean isValid = SessionUtils.isValid(httpServletRequest, "sessionInfo");
		logger.info(isValid);
		String url = null;
		if(!isValid){
			url = "/login.jsp";
		}
		else {
			url = "/SecurityJsp/downLoad.jsp";
		}
		try{
			httpServletRequest.getRequestDispatcher(url).forward(httpServletRequest, httpServletResponse);
		}
		catch(Exception e){
			logger.error("跳转页面失败",e);
		}
	}
	
	protected void doGet(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse){
		doPost(httpServletRequest, httpServletResponse);
	}
}
